package com.chendx.store.order.controller;

import com.alibaba.fastjson.JSON;
import com.chendx.model.common.dtos.ResponseResult;
import com.chendx.model.order.pojo.OrderItem;
import com.chendx.store.api.order.OrderItemControllerApi;
import com.chendx.store.order.service.OrderItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by chendx on 2022/4/21.
 */
@RestController
@RequestMapping("/api/item")
public class OrderItemController implements OrderItemControllerApi {

    @Autowired
    private OrderItemService orderItemService;

    @Override
    @GetMapping("/one")
    public ResponseResult one(String id) {
        OrderItem orderItem = orderItemService.getById(id);
        return ResponseResult.okResult(orderItem);
    }

    @Override
    @GetMapping("/pj")
    public ResponseResult updateOrderItemStatus(String id) {
        return orderItemService.pj(id);
    }
}
